package com.hdu.hot100.backTrack;

import java.util.ArrayList;
import java.util.List;

public class lc78 {
    class Solution {

        List<List<Integer>> ans = new ArrayList<>();
        List<Integer> path = new ArrayList<>();


        public List<List<Integer>> subsets(int[] nums) {
            f(nums, 0);
            return ans;
        }

        void f(int[] nums, int startIndex)
        {
            ans.add(new ArrayList<>(path));
            for (int i = startIndex; i < nums.length; i++) {
                path.add(nums[i]);
                f(nums, i + 1);
                path.remove(path.size() - 1);
            }
        }
    }
}
